home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 19
/
Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso
/
Aminet
/
comm
/
cnet
/
cnet_backup.lha
/
cnetamigabackup
/
CNetBackUpA
< prev
Wrap
Text File
|
1997-04-06
|
8KB
|
198 lines
/**************************************************************************\
$VER: CNet Amiga BackUpA; Amaint Module, v3.51 (6-Apr-97) by Dotoran!
\**************************************************************************/
options results;signal on SYNTAX;signal on ERROR;signal on IOERR
a=sourceline(2);parse var a . ", "ver" ("vdate")" .
tr=transmit;se=sendstring;gc=getchar;gu=getuser;gs=getscratch;mg=maygetchar
a="rexxsupport.library";if ~show("l",a) then if ~addlib(a,0,-30) then exit
parse source . . fp .;df=left(fp,max(lastpos('/',fp),lastpos(':',fp)))
tim=date(s);c=0;changewhere "CNet BackUpA";gu 1100454;more=result
setobject 0;putuser 1100454;fnR=df"CNetBackUp.";cfg=fnR"CFG"
tr "f1n1z4cer1 CNet Amiga BackUp, "ver" AMaint z0r0"
if ~exists(cfg) then do
tr "n1cb`ca"df"CNetBackUp.CFGcb' c6was c9NOT c6found.";signal QUITBYE;end
else call READCONFIG
do i=1 to files
if tim-tim.i>=day.i then do;c=c+1;bn.c=i;end
file.i=overlay(tim,file.i,1)
end i;call SAVECONFIG
if c=0 then do;tr "n1caNothing c6to cbBackUp c6tonight.";signal QUITBYE;end
do z=1 to c
file=bn.z;call READFILE;zb=(ext.file~="BAK")
badflop=0;tem=tem.file;des=des.file
bname="CNetBackUp_"ext.file".LHA"
tr "n1z4cer1 Backing Up CNet Using `"nam.file"' File z0r0n1"
if zb then do
zz=pragma("w","n");a=exists(des);zz=pragma("w")
if a=0 then do;des=df;for.file=0;badflop=1;end
if exists(des||bname) then do
address command 'PROTECT "'des||bname'" d'
address command 'DELETE "'des||bname'"';end
end
mi=0;miF.=0;fi=1;fi.=""
do i=1 to total;fn=fn.i
tr "cf[z0car1 Testing File r0cf> ca"fn
if ~exists(fn) then do
tr "cf[z5cb Missing File z0> cd"fn
mi=mi+1;mi.mi=fn;iterate i;end
if zb then do
if dir.a then do
f1=pos(":",fn);d1=left(fn,f1-1);fn=substr(fn,f1+1)
if ~exists(tem||d1) then do
tr "cf[z0c9r1 Creating Dir r0cf> c9"d1
address command 'MAKEDIR "'tem||d1'"';end
do j=1 until f1=0;f1=pos("/",fn)
if f1>0 then do;d1=d1"/"left(fn,f1-1);fn=substr(fn,f1+1);end
if ~exists(tem||d1) then do
tr "cf[z0c9r1 Creating Dir r0cf> c9"d1
address command 'MAKEDIR "'tem||d1'"';end
end j
tr "cf[z0cbr1 Copying File r0cf> cb"fn.i
address command 'COPY "'fn.i'" "'tem||d1'/'fn'"'
end
else do
if index(":/",right(fn,1))>0 then fn=left(fn,length(fn)-1)
if length(tem||bname||fi.fi||fn)+26<=150 then fi.fi=fi.fi" "fn
else do;fi=fi+1;fi.fi=fi.fi" "fn;end
end
end
else do
if index(":/",right(fn.i,1))>0 then do ; zy=showdir(fn.i,"f"," ")
tr "cf[z0cdr1 Cloning Path r0cf> cd"fn.i"#?.bak"
do j=1 to words(zy) ; zz=word(zy,j)
if right(upper(zz),4)~=".BAK" then do ; se " "zz".bak..."
address command 'COPY "'fn.i||zz'" "'fn.i||zz'.bak" COM';tr "ok";end
end j
end
else do
tr "cf[z0cdr1 Cloning File r0cf> cd"fn.i".bak"
address command 'COPY "'fn.i'" "'fn.i'.bak" COM'
end
end
end i
file.file=overlay(tim,file.file,1);call SAVECONFIG
if badflop=0 & for.file>0 then do
tr "cf[z0ccr1 Formatting.. r0cf> cc"des" cf(cc"word("FULL QUICK",for.file)"cf)"
form="";if for.file=2 then form="QUICK"
tr "#4FORMAT <nil: drive "des" name CNetBackUps NOICONS "form" FFS}";end
if exists(tem||bname) then do;a=tem||bname;c=2
do until ~exists(tem||a);a=left(bname,length(bname)-4)"_"c".LHA";c=c+1;end
tr "cf[z0cer1 LHA Exists...r0cf> c6renamed as cb`ca"a"cb'"
address command 'rename "'tem||bname'" "'tem||a'"';end
if zb then do
tr "cf[z0cer1 Packing File r0cf> ce"bname"n1"
zz="";if com.file then zz="z";z2="";if dis.file then z2="F"
temp=tem;if bac.file then temp=des
if dir.file then tr "#4LHA -arex2D2"zz||z2"P"pri.file" a "temp||bname" "tem"#?}"
else do
do i=1 to fi
lfn1="";lfn2="";do j=1 to words(fi.i);f.j=word(fi.i,j)
if word(statef(f.j),1)~="DIR" then lfn2=lfn2" "f.j;else lfn1=lfn1" "f.j
end j;fi.i=strip(lfn1)" "strip(lfn2)
tr "#4LHA -arex2D2"zz||z2"P"pri.file" a "tem||bname" "fi.i"}"
end i
end
if com.file then do
tr "#4LHA -arex2D2Z"z2"P"pri.file" a "temp||bname"2 "temp||bname"}"
tr "#4DELETE "temp||bname"}"
tr "Renaming `"temp||bname"2'...#4RENAME "temp||bname"2 "temp||bname"}ok"
end
if ~bac.file then do
if exists(des||bname) then do;a=des||bname;c=2
do until ~exists(des||a);a=left(bname,length(bname)-4)"_"c".LHA";c=c+1;end
tr "cf[z0cer1 LHA Exists...r0cf> c6renamed as cb`ca"a"cb'"
address command 'rename "'des||bname'" "'tem||a'"';end
tr "cf[z0cdr1 Copying File r0cf> cd"bname
address command 'COPY "'tem||bname'" "'des||bname'"'
end
d=date("s");da=left(date("w",d,"s"),3)"., "date("m",d,"s")" "strip(substr(d,7,2),"l","0")", "left(d,4)" @ "time("c")
com="CNet Amiga BackUp, "ver" Created on "da
address command 'FILENOTE "'des||bname'" "'com'"'
address command 'PROTECT "'des||bname'" re'
if dir.file | ~bac.file then do;tem=tem.file
tr "cf[z0c6r1 Cleaning Up! r0cf> c6"tem
address command "DELETE "tem"#? ALL"
end
se "cf[z0cbr1 Testing LHA r0cf> "
log=left(bname,length(bname)-4)
se "#4LHA -P"pri.file" t >sysdata:log/"log" "des||bname"}"
call open(f1,"sysdata:log/"log,"r")
do i=1 until eof(f1);l.i=readln(f1);end i;t=i-1
call close(f1);check=substr(l.t,11,7)
if check="success" then do
test=1;tr "caPassed Integrity Check!";end
else do;test=0;tr "c9Failed Integrity Check!";end
call open(f1,"sysdata:log/"log,"a")
call writeln(f1,"");call writeln(f1,com)
if badflop=1 then do
call writeln(f1,"")
call writeln(f1,"No Floppy in DESTINATION DRIVE, so archive was stored in "df)
end
call close(f1)
end
if test=0 | badflop=1 | mai.file=0 then do
if zb then do
tr "cf[z0cbr1 SysMail Sent r0cf> c6CNet BackUp: "log
loadeditor "sysdata:log/"log;setmailsubj "CNet BackUp: "log;writemail 1;cleareditor
end
if mi>0 then do;call open(f1,"ram:cnetbackup","w")
call writeln(f1,"The following files were MISSING from the `"nam.file"' backup file, so were NOT backed up:n1")
do zz=1 to mi;call writeln(f1,mi.zz);end zz;call writeln(f1,"n1"com);call close(f1)
loadeditor "ram:cnetbackup";setmailsubj "Missing BackUp Files Alert!";writemail 1;cleareditor
address command "DELETE ram:cnetbackup";end
end
end z
tr "n1z4cer1 CNet Amiga BackUp AutoMaint Complete! z0r0"
QUITBYE:;setobject more;putuser 1100454;exit
SAVECONFIG:;call open(f1,cfg,"w");call writeln(f1,files)
do i=1 to files;call writeln(f1,file.i);end i;call writeln(f1,drives);call close(f1);save=0
READCONFIG:;call open(f1,cfg,"r");files=readln(f1);do i=1 to files;file.i=readln(f1)
parse var file.i tim.i"|"ext.i"|"nam.i"|"tem.i"|"des.i"|"day.i"|"dir.i"|"bac.i"|"for.i"|"pri.i"|"mai.i"|"com.i"|"dis.i"|"j;end i;drives=readln(f1);call close(f1);return
READFILE:
call open(f1,fnR||ext.file,"r")
do i=1 until eof(f1);fn.i=readln(f1);end i
call close(f1);total=i-1;return
SYNTAX:;ERROR:;IOERR:;e1="n1 Error: "rc" ("errortext(rc)")"
e2=" Line: "left(sigl,4)"File:";c="`"fp", "ver"'";e2=e2" "c;tr e1;tr e2
logentry e1;logentry e2;e=strip(translate(sourceline(sigl),"\{",""))
do while e~="";e3="Source: "left(e,37);tr e3;logentry e3;e=substr(e,38);end
bufferflush;signal QUITBYE
/**************************************************************************\
\****************************************** Frontiers BBS (716)/823-9892 **/